<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/25 0025
 * Time: 上午 11:00
 */

defined('BASEPATH') OR exit('No direct script access allowed');

class Login extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->database();
        $this->load->helper('url');
    }

    public function index()
    {
        $data = $_POST;
        $this->load->model('User_model');
        $res = $this->User_model->doLogin($_POST);
        if($res)
        {
            // 存session
            $_SESSION['user_id'] = $res['user_id'];
            $_SESSION['username'] = $res['username'];
            redirect('home');
        }
        else
        {
            redirect('home');
        }
    }

    public function register()
    {
        //echo 123;die;
        //echo $_POST['mobile'];die;

        $this->load->model('User_model');
        $res = $this->User_model->faceAddUser($_POST);
        //var_dump($res);
        if($res)
        {
            redirect('home');
        }

    }













}